<template>
  <div id="main">
        <ul>
            <li v-for="item in moives" :key="item.id">
                <router-link to="/show_movies_item">
                    <div class="li-item">
                        <!-- <h2 v-if="index ==0 || arr[index].comingTitle != arr[index-1].comingTitle">{{item.comingTitle}}</h2> -->
                        <div class="content">
                            <img :src="item.img" alt="">
                            <div class="more_content">
                                <div class="title_and_icon">
                                    <span class="title_content">{{item.nm}}</span>
                                    <span v-if="item.ver.indexOf('IMAX') !== -1"><img src="../../assets/v2dimax.png" alt="" style="width:42px; height:14px; margin-left:6px"></span>
                                </div>
                                <div class="more_content_see">
                                    <span><span class="person_num">{{item.wish}}</span>人想看</span>
                                    <span class="stars">主演：{{item.star}}</span>
                                    <span>{{item.rt}}上映</span>
                                </div>
                            </div>
                            <button class="want">购票</button>
                        </div>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>
</template>

<script>
import axios from 'axios'
export default {
  name:"MovieList",
  data(){
    return {
      moives:[]
    }
  },
  mounted(){
    axios.get("/api/mmdb/movie/v3/list/hot.json?ct=%E6%B7%B1%E5%9C%B3&ci=30&channelId=4")
        .then((res)=>{
            // console.log(res);
            this.moives = res.data.data.hot
        })
  }
}
</script>

<style scoped>
    ul{
          list-style: none;
          display: flex;
          flex-direction: column;
      }
      ul::after{
          content:"";
          display:block;
          height: 1.3867rem;
      }
      li{
          background-color: #fff;
      }
      a{
          text-decoration: none;
          color: black;
      }

      h1,h2{
          font-size: 14px;
          font-weight: 400;
      }
    

      .li-item{
          padding: 0 10px;
      }
      .content{
          width: 100%;
          margin-top: 10px;
          /* background-color: aqua; */
          display: flex;
          position: relative;
          /* align-items: center; */
          /* border-bottom: 1px solid black; */
      }
      .content img{
          width: 1.7067rem;
          height: 2.4rem;
          margin-top: 10px;
      }
      .more_content{
          width: 80%;
          height: 2.4rem;
          padding: 10px;
          font-size: 14px;
          text-align: left;
          color: rgb(137, 137, 137);
      }

      
      .more_content_see{
          display: flex;
          height: 68px;
          flex-direction: column;
          color: rgb(102, 102, 102);
          border-bottom: 1px solid rgb(240, 240, 240);
          /* margin-bottom: 2px; */
          /* justify-content: space-around; */
          padding-bottom: 10px;
      }
      /* .more_content_see span{
          margin-bottom: 10px;
      } */

      .title_content{
          font-size: 16px;
          font-weight: 700;
          color: black;
      }

      .more_content_see span:first-child{
          margin-top: 5px;
      }

      .person_num{
          font-size: 14px;
          color: rgb(250, 175, 0);
      }

      .want{
          position: absolute;
          right: 0;
          top: 50%;
          margin-top: -14px;
      }
      button{
          width: 52px;
          height: 28px;
          outline: none;
          border: none;
          border-radius: 18px;
          color: #fff;
          font-size: 12px;
          background-color: rgb(240, 61, 55);
      }
      .stars{
          width: 80%;
          height: 24px;
          line-height: 24px;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
      }
</style>>
    